<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
	<meta charset="UTF-8" />
	<title>千郡医疗-提现</title>
	<meta name="keywords" content="" />
	<meta name="description" content="" />
	<meta name="format-detection" content="telephone=no" />
	<link rel="stylesheet" th:href="@{/weixin/css/weui.min.css}" />
	<link rel="stylesheet" th:href="@{/weixin/css/style.css}" />
    <script th:src="@{/weixin/js/adaptive.js}"></script>
	<script th:src="@{/weixin/js/fastclick.min.js}"></script>
	<script th:src="@{/weixin/js/zepto.min.js}"></script>
	<script type="text/javascript" th:src="@{/weixin/js/weui.min.js}"></script>
</head>
<body>
	<section class="cashBox">
		<ul>
			<li>
				<a th:href="@{/weixin/rebate/selectCard}">
					<p class="name">到账银行卡</p>
					<p class="bank" th:text="${card.bankName}">中国民生银行</p>
					<p class="num mt20" th:text="${card.bankCardNum}">6226 0584 5482 5482</p>
				</a>
			</li>
			<li>
			<form id="form">
				<p class="name">提现金额</p>
				<div class="txtBox box-h"><sup>￥</sup>
					<input type="hidden" th:value="${card.customerName}" name="customerName" />
					<input type="hidden" th:value="${card.bankName}" name="bankName" />
					<input type="hidden" th:value="${card.bankCardNum}" name="bankCardNum" />
					<input type="hidden" th:value="1" name="status" />
					<input type="number" name="withdrawRebate" id="withdrawRebate" class="txt flex" th:value="${allRebate}" />
				</div>
				<p class="num">可用余额 <span th:text="${allRebate}">152.00</span> 元</p>
			</form>
			</li>
		</ul>
		<p class="btm">
			<a href="javascript:;" id="submit" class="comBtn">提取现金</a>
		</p>
	</section>
	<script type="text/javascript">
	$($("#submit").click(function submit() {
		if(!(/^\d+(\.\d{2})?$/.test($("#withdrawRebate").val()))){ 
	        weui.alert("请输入正确的数字");  
	        return false; 
	    }
		
		if($("#withdrawRebate").val() == 0){ 
	        weui.alert("请输入大于0的金额");  
	        return false; 
	    }

		var l = weui.loading("正在提交")
		$.ajax({
			cache : true,
			type : "POST",
			url : "/qianjun/weixin/rebate/cash",
			data : $('#form').serialize(),
			error : function(request) {
				l.hide();
				weui.alert("Connection error");
			},
			success : function(data) {
				l.hide();
				if (data.success){
                    window.location.href =  "/qianjun/weixin/rebate";
					return;
				}
				weui.alert(data.msg);
			}
		});
	}))
	</script>
</body>
</html>